﻿Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class Service1


    <WebMethod()> _
    Public Function getBestellingenByKlantID(ByVal id As Integer) As List(Of BestellingBean)
        Dim linq_bestelling As New Linq_Bestelling()
        Console.WriteLine("getBestellingbyKlantnaam")
        Return linq_bestelling.getBestellingenVanKlant(id)
    End Function

    <WebMethod()> _
    Public Function getKlantbyUsername(ByVal username As String) As KlantBean
        Dim linq_klant As New Linq_Klant()
        Console.WriteLine("getKlantById")
        Return linq_klant.getKlantByUserNaam(username)
    End Function

    <WebMethod()> _
    Public Function getKlantbyId(ByVal id As Integer) As KlantBean
        Dim linq_klant As New Linq_Klant()
        Console.WriteLine("getKlantById")
        Return linq_klant.getKlantById(id)
    End Function

    <WebMethod()> _
    Public Function getAlleKlanten() As List(Of KlantBean)
        Dim linq_klant As New Linq_Klant()
        Console.WriteLine("getAlleKLanten")
        Return linq_klant.getAlleKlanten()
    End Function

    <WebMethod()> _
    Public Function insertProduct(ByVal naam As String, ByVal prijs As Decimal, ByVal omscr As String) As Boolean
        Dim lp As New Linq_Product
        Return lp.createProduct(naam, prijs, omscr)
    End Function

    <WebMethod()> _
    Public Function insertBestelling(ByVal b As BestellingBean) As Boolean
        Dim lBestelling As New Linq_Bestelling
        Return lBestelling.createBestelling(b)
    End Function

    <WebMethod()> _
    Public Function createBestellingID() As Integer
        Dim lBestelling As New Linq_Bestelling
        Return lBestelling.createBestellingId()
    End Function

    <WebMethod()> _
    Public Function getAlleProducten() As List(Of ProductBean)
        Dim lp As New Linq_Product
        Return lp.getAlleProducten
    End Function

    <WebMethod()> _
    Public Function getProductById(ByVal pId As Integer) As ProductBean
        Dim lp As New Linq_Product
        Return lp.getProductByID(pId)
    End Function

    <WebMethod()> _
    Public Function getProductId(ByVal prodNaam As String, ByVal prodPrijs As String) As Integer
        Dim lp As New Linq_Product
        Return lp.getProductId(prodNaam, prodPrijs)
    End Function

    <WebMethod()> _
    Public Function checkUserName(ByVal uName As String) As Boolean
        Dim lk As New Linq_Klant
        Return lk.checkUserName(uName)
    End Function

    <WebMethod()> _
    Public Function createUser(ByVal k As KlantBean) As Boolean
        Dim lk As New Linq_Klant
        Return lk.createKlant(k)
    End Function
End Class

